<template>
    <div class="wrap">
      <div class="left-wrap">
        <div class="phone-wrap">
          <div class="phone-inner">
            <div class="msg">
              <div class="title">{{title}}</div>
              <div style="overflow:hidden">
                <img :src="icon | realImgSrc">
                <div class="description">{{description}}</div>  
              </div>
            </div>
            <img :src="icon | realImgSrc" class="person">
          </div>
        </div>      
      </div>
      <div class="right-wrap">
        <div class="form-inner">
          <div class="form-group">
            <h2>作品设置</h2>
          </div>
          <div class="form-group">
            <div class="img-wrap">
              <img :src="icon | realImgSrc">
            </div>
            <a class="changeIcon" href="javascript:;" @click="changePic">更换Icon图片</a>
          </div>          
          <div class="form-group">
            <input type="text" class="form-control" v-model="title">
          </div>
          <div class="form-group">
            <textarea class="form-control" rows="3" v-model="description"></textarea>
          </div>
          <div class="form-group">
            <div class="btn btn-success" @click="save">保存</div>
          </div>           
        </div>
      </div>
    </div>
</template>
<script>
  export default {
    props: {
      title : {
        type: String,
        require: true,
        twoway: true
      },
      description : {
        type: String,
        require: true,
        twoway: true
      },
      icon : {
        type: [String , Number],
        require: true,
        twoway: true
      },
      show : {
        type: Boolean,
        require: true,
        twoway: true
      }        
    },
    data: function(){
      return {
        showPictureDialog: false
      }
    },
    methods: {
      changePic: function(){
        this.$dispatch("showPictureDialog", "changeAppIcon");
      },
      save: function(){
        this.show = false;
      }
    },
    components : {
      pictureDialog : require('./plugin/pictureDialog.vue'),
    }    
  }
</script>
<style scoped>
  .wrap{
    overflow: hidden;
    width: 100%;
  }
  .left-wrap {
    float:left;
    width: 55%;
  }
  .right-wrap{
    float: right;
    width: 45%;
  }
  .phone-wrap {
    position: relative;
    width: 322px;
    height: 612px;
    margin: 10px auto;
    background: url(../static/img/iphone_bg2.png) no-repeat 0 0;
  } 
  .phone-inner {
    height: 488px;
    border-left: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
    background: #fff;
    width: 322px;
    position: relative;
    top: 63px;
    z-index: 60;  
  } 
  .phone-inner .person{
    width: 50px;
    position: absolute;
    top: 15px;
    right: 5px;
    height: 50px;    
  }
  .msg {
    position: absolute;
    border: 1px solid #4cae4c;
    border-radius: 5px;
    padding: 8px;
    width: 250px;
    top: 15px; 
    left: 5px;   
  }
  .msg::before{
    content:'';
    position:absolute;
    top:5px;
    right:-10px;
    border:5px solid rgba(0,0,0,0);
    border-left-color: #4cae4c;
  }
  .msg::after{
    content:'';
    position:absolute;
    top:5px;
    right:-9px;
    border:5px solid rgba(0,0,0,0);
    border-left-color: #fff;
  }  
  .msg .title{
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.6;
    height: 25px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .msg img{
    float:left;
    width:60px;
    height:60px;
  }
  .msg .description {
    margin-left: 66px;
    height: 60px;
    overflow: hidden;
    color: #83817b;
    font-size: 12px;
    line-height: 1.6;
    word-break: break-all;    
  }
  .form-inner {
    margin-top:50px;
    margin-right: 50px;
  }
  .form-inner h2{
    font-size: 16px;
  }
  .form-inner .img-wrap{
    display: inline-block;
    width:80px;
    height:80px;
  }
  .form-inner .img-wrap img{
    width: 100%;
    height:100%;
  }
  .changeIcon {
    display: inline-block;
    text-decoration: underline;
    color:#5cb85c;
  }
</style>